#ifndef TRGAMEPROPERTY_H
#define TRGAMEPROPERTY_H

///@todo urgent
///consider making this abstract base
///revise whole trGameProperty class concept


/*
Abstract template base class
interface for higher level
game "properties" attached to
IGameObject objects with features
*/

#include <irrlicht.h>

namespace tetra
{

enum E_GAMEPROPERTY
{

    EU32,

    ES32,

    EF32,

    EBOOL,

    ECHAR8,

    EVECTOR3DF,

    EEXAMPLE_PROP_TREE_SHAPE //example here, a tree shape would maybe be
                                //a struct, with values outlining an
                                //an algorithm to create random trees

};

//abstract base design
class trGameProperty //: public trGameProperty_
{

    irr::core::stringc name; //name of the property

    E_GAMEPROPERTY type; //type

public:

    //! Default constructor
    trGameProperty();

    //! Constructor
    trGameProperty( const irr::core::stringc& name );

    //! Destructor
    ~trGameProperty();

    //! Returns enum type
    virtual const E_GAMEPROPERTY getType(void) =0;

    //operator

    virtual trGameProperty& operator=(const trGameProperty& other) =0;

};

template <typename T>

class trGameProperty_ : public trGameProperty
{

    T data;
    //irr::core::stringc name; //name of the property

    //E_GAMEPROPERTY type;

public:

    //operators

    T& operator()(){ return *data; };

    const trGameProperty& operator=( const T &other ){ data = other; return this; };

    bool operator==( const T& other ){ if ( data == other ){ return 1; }; if ( data != other ){ return 0; }; };
    void operator++(){ data++; };
    void operator--(){ data--; };

    //functions

    //! Returns the data
    T& getData(){ return &data; };

    //! Default constructor
    trGameProperty_();

    //! Constructor
    trGameProperty_( const T& data, const irr::core::stringc& , irr::u32 );

    //! Copy constructor

    //! Destructor
    ~trGameProperty_();

};


//////////////
// example ///
//////////////

class trGamePropertyf32 : public trGameProperty
{

    irr::f32 data;
    E_GAMEPROPERTY type;

public:

    //! Returns the data
    virtual irr::f32 getData();

    //! Sets the data
    virtual void setData( irr::f32 data );

    //! Default constructor
    trGamePropertyf32();

    //! Constructor
    trGamePropertyf32( irr::f32 data, const irr::core::stringc& name );

    //! Destructor
    ~trGamePropertyf32();

};


}; //end namespace tetra

#endif


